﻿--
-- Dropping stored procedure pr_PhieuNhapKho_SelectAll : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_PhieuNhapKho_SelectAll]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_PhieuNhapKho_SelectAll]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_PhieuNhapKho_SelectAll
-- Author:	MinhNN
-- Create date:	5/14/2012 10:01:15 PM
-- Description:	This stored procedure is intended for selecting all rows from PhieuNhapKho table
-- ==========================================================================================
Create Procedure pr_PhieuNhapKho_SelectAll
As
Begin
	Select 
		[MaPhieuNhap],
		[KhoHang],
		[NgayPhieu],
		[MaNV]
	From PhieuNhapKho
End

GO


--
-- Dropping stored procedure pr_PhieuNhapKho_SelectRow : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_PhieuNhapKho_SelectRow]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_PhieuNhapKho_SelectRow]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_PhieuNhapKho_SelectRow
-- Author:	MinhNN
-- Create date:	5/14/2012 10:01:15 PM
-- Description:	This stored procedure is intended for selecting a specific row from PhieuNhapKho table
-- ==========================================================================================
Create Procedure pr_PhieuNhapKho_SelectRow
	@MaPhieuNhap varchar(10)
As
Begin
	Select 
		[MaPhieuNhap],
		[KhoHang],
		[NgayPhieu],
		[MaNV]
	From PhieuNhapKho
	Where
		[MaPhieuNhap] = @MaPhieuNhap
End

GO


--
-- Dropping stored procedure pr_PhieuNhapKho_Insert : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_PhieuNhapKho_Insert]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_PhieuNhapKho_Insert]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_PhieuNhapKho_Insert
-- Author:	MinhNN
-- Create date:	5/14/2012 10:01:15 PM
-- Description:	This stored procedure is intended for inserting values to PhieuNhapKho table
-- ==========================================================================================
Create Procedure pr_PhieuNhapKho_Insert
	@MaPhieuNhap varchar(10),
	@KhoHang nvarchar(50),
	@NgayPhieu datetime,
	@MaNV varchar(10)
As
Begin
	Insert Into PhieuNhapKho
		([MaPhieuNhap],[KhoHang],[NgayPhieu],[MaNV])
	Values
		(@MaPhieuNhap,@KhoHang,@NgayPhieu,@MaNV)

End

GO


--
-- Dropping stored procedure pr_PhieuNhapKho_Update : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_PhieuNhapKho_Update]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_PhieuNhapKho_Update]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_PhieuNhapKho_Update
-- Author:	MinhNN
-- Create date:	5/14/2012 10:01:15 PM
-- Description:	This stored procedure is intended for updating PhieuNhapKho table
-- ==========================================================================================
Create Procedure pr_PhieuNhapKho_Update
	@MaPhieuNhap varchar(10),
	@KhoHang nvarchar(50),
	@NgayPhieu datetime,
	@MaNV varchar(10)
As
Begin
	Update PhieuNhapKho
	Set
		[KhoHang] = @KhoHang,
		[NgayPhieu] = @NgayPhieu,
		[MaNV] = @MaNV
	Where		
		[MaPhieuNhap] = @MaPhieuNhap

End

GO


--
-- Dropping stored procedure pr_PhieuNhapKho_DeleteRow : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_PhieuNhapKho_DeleteRow]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_PhieuNhapKho_DeleteRow]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_PhieuNhapKho_DeleteRow
-- Author:	MinhNN
-- Create date:	5/14/2012 10:01:15 PM
-- Description:	This stored procedure is intended for deleting a specific row from PhieuNhapKho table
-- ==========================================================================================
Create Procedure pr_PhieuNhapKho_DeleteRow
	@MaPhieuNhap varchar(10)
As
Begin
	Delete PhieuNhapKho
	Where
		[MaPhieuNhap] = @MaPhieuNhap

End

GO
